pub fn new_birthday_probability(n: u32) -> f64 {
    if n < 2 {
        return 0.0; // 如果人数小于2，不可能有重复生日
    }

    const DAYS_IN_YEAR: u32 = 365;

    // 计算没有人生日重复的概率
    let mut prob_no_shared = 1.0;
    for i in 0..n {
        prob_no_shared *= (DAYS_IN_YEAR - i) as f64 / DAYS_IN_YEAR as f64;
    }

    // 至少两人生日相同的概率
    let prob_shared = 1.0 - prob_no_shared;

    // 保留四位小数
    (prob_shared * 10_000.0).round() / 10_000.0
}
